// component/tab-bar/index.js
const config = require('../../config')
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    active: Number, // 当前选中的分页索引
    tabs:String,
    venueShow:Boolean  //组件true是场馆，
  },

  /**
   * 组件的初始数据
   */
  data: {
    isFyApp: config.isFyApp,
    tabBarArray:  config.tabBarArray(),
    tabBarArrays:  config.tabBarArrays(),
    tabBarVenuArray: config.tabBarVenuArray(),
    tabBarArrayM: config.tabBarArrayM(),
    activeColor: config.tabBarActiveColor,
    activeColors: config.tabBarActiveColors,
    inactiveColor: config.tabBarInactiveColor
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 景区跳转
    onChangeTabbar(event) {
      const index = event.detail
      this.triggerEvent('tabBarChange', {
        index,
        url: this.data.tabBarArray[index].pagePath
      })
    },
    // 场馆
    onChangeTabbarc(event){
      const index = event.detail
      this.triggerEvent('tabBarChange', {
        index,
        url: this.data.tabBarVenuArray[index].pagePath,
        stop:this.data.tabBarVenuArray[index].stop ? this.data.tabBarVenuArray[index].stop :'',
        play:this.data.tabBarVenuArray[index].play ? this.data.tabBarVenuArray[index].play :''
      })
    },
    // 首页tabbar
    onChangeTabbars(event) {
      const index = event.detail
      this.triggerEvent('tabBarChange', {
        index,
        url: this.data.tabBarArrays[index].pagePath
      })
    },
    onChangeTabbarM(event){
      const index = event.detail
      this.triggerEvent('tabBarChange', {
        index,
        url: this.data.tabBarArrayM[index].pagePath
      })
    }
  }
})
